<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Setup | GeoContexter Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<link href="admin_media/css/layout_3col_standard.css" rel="stylesheet" type="text/css"/>

<!--[if lte IE 7]>
<link href="admin_media/css/patches/patch_3col_standard.css" rel="stylesheet" type="text/css" />
<![endif]-->

<link href="admin_media/css/setup.css" rel="stylesheet" type="text/css"/>

<script type="text/javascript" src="library/jquery/jquery.js"></script>

<script type="text/javascript">

 $(document).ready(function() {

   <?php if(empty($form_namespace_value)): ?>
   $(".namespace").hide();
   $("#namespace_value").prop("disabled","disabled");
   <?php else: ?>
   $("#serial").prop("readonly",false);
   <?php endif; ?>

   $("#namespace").change(function() {

    $("select option:selected").each(function () {
        if($(this).text() == 'namespace')
        {
            $(".namespace").show('slow');
            $("#namespace_value").prop("disabled",false);
            $("#serial").prop("readonly",false);
            $("#serial").prop("value","");
            $("#insertsamplecontent").prop("disabled",false);
            $("#insertsamplecontent").prop("checked",false);
        }
        else if($(this).text() == 'standalone')
        {
            $("#namespace_value").prop("disabled","disabled");
            $(".namespace").hide('slow');
            $("#serial").prop("readonly","readonly");
            $("#serial").prop("value","1");
            $("#insertsamplecontent").prop("disabled","disabled");
            $("#insertsamplecontent").prop("checked",false);
        }
        else if($(this).text() == 'test')
        {
            $("#namespace_value").prop("disabled","disabled");
            $(".namespace").hide('slow');
            $("#serial").prop("readonly","readonly");
            $("#serial").prop("value","9222");
            $("#insertsamplecontent").prop("disabled",false);
            $("#insertsamplecontent").prop("checked","checked");
        }
        });
   });

   $("#insertsamplecontent").click(function() {
      if (this.checked)
      {
        $("#namespace_spatial").hide('slow');
      }else
      {
        $("#namespace_spatial").show('slow');
      }
    });
 });

</script>

</head>
<body>
<div id="header">
  <div class="page_margins">
    <div class="page">
      <h1>Geo Contexter Setup</h1>
      </div>
  </div>
</div>


<!-- begin: main content area #main -->
<div id="main">
  <div class="page_margins">
    <div class="page">
      <!-- begin: #col1 - first float column -->
      <div id="col1">
        <div id="col1_content" class="clearfix">
          <!-- not in use -->
        </div>
      </div>
      <!-- end: #col1 -->
      <!-- begin: #col2 second float column -->
      <div id="col2">
        <div id="col2_content" class="clearfix">
          <!-- not in use -->
        </div>
      </div>
      <!-- end: #col2 -->
      <!-- begin: #col3 static column -->
      <div id="col3">
        <div id="col3_content" class="clearfix"> <a id="content" name="content"></a>
          <!-- skiplink anchor: Content -->

        <!--#######################-->
        <!-- BEGIN: Setup form -->
        <!--#######################-->



            <!-- begin: error messages -->
            <?php if(count($this->error)>0): ?>
              <div id="error">
                <a name="setup_error"></a>
                <h2>System Error Messages:</h2>
                <ul role="status">
                <?php foreach($error as $err): ?>
                  <li class="error"><?php echo $err; ?></li>
                <?php endforeach; ?>
                </ul>
              </div>
            <?php endif; ?>
            <!-- end: error messages -->

            <!-- begin: setup data form -->
            <a name="setup_form"></a>
            <form name="setup" id="setup" method="post" action="<?php echo $basePath; ?>/setup" accept-charset="utf-8">

             <h2>Postgresql database connection data</h2>
             <ul>

                <li class="setup_item_label"><label for="dbhost">Database host:</label></li>
                <li class="setup_item_content">
                    <input name="dbhost" id="dbhost" type="text" size="40" maxlength="255" value="<?php if(empty($form_dbhost)) echo 'localhost';else echo $escape->escapeHtmlAttr($form_dbhost); ?>" />
                </li>

                <li class="setup_item_label"><label for="dbport">Database port:</label></li>
                <li class="setup_item_content">
                    <input name="dbport" id="dbport" type="text" size="6" maxlength="6" value="<?php if(empty($form_dbport)) echo '5432';else echo $escape->escapeHtmlAttr($form_dbport); ?>" />
                </li>

                <li class="setup_item_label"><label for="dbuser">Database user:</label></li>
                <li class="setup_item_content">
                    <input name="dbuser" id="dbuser" type="text" size="40" maxlength="255"  value="<?php if(isset($form_dbuser)) echo $escape->escapeHtmlAttr($form_dbuser); ?>" />
                </li>

                <li class="setup_item_label"><label for="dbpasswd">Database password:</label></li>
                <li class="setup_item_content">
                    <input name="dbpasswd" id="dbpasswd"  type="password" size="40" maxlength="255"  value="<?php if(isset($form_dbpasswd)) echo $escape->escapeHtmlAttr($form_dbpasswd); ?>"/>
                </li>

                <li class="setup_item_label"><label for="dbname">Database name:</label></li>
                <li class="setup_item_content">
                    <input name="dbname" id="dbname" type="text" size="40" maxlength="255" value="<?php if(isset($form_dbname)) echo $escape->escapeHtmlAttr($form_dbname); ?>" />
                </li>

            </ul>

            <h2>Create a login password</h2>
            <p>Please remember/write down the password of the <strong>superuser</strong> login. You need it for login into the administration.</p>
            <ul>
                <li class="setup_item_label"><label for="superuserlogin">Superuser login:</label></li>
                <li class="setup_item_content">
                    <input name="superuserlogin" id="superuserlogin" type="text" size="40" maxlength="255" value="<?php if(isset($form_superuser_login)) echo $escape->escapeHtmlAttr($form_superuser_login); ?>" />
                </li>

                <li class="setup_item_label"><label for="superuserpassword" >Superuser password:</label></li>
                <li class="setup_item_content">
                    <input name="superuserpassword" id="superuserpassword" type="text" size="40" maxlength="255" value="<?php if(isset($form_superuser_password)) echo $escape->escapeHtmlAttr($form_superuser_password) ?>" />
                </li>

                <li class="setup_item_label"><label for="superusertimezone">Superuser timezone:</label></li>
                <li class="setup_item_content">
                    <select name="superusertimezone" id="superusertimezone" size="1" title="timezone selection">
                    <?php foreach($timezone_identifiers as $timezone): ?>
                    <option value="<?php echo $timezone; ?>"<?php if(strcasecmp($form_superuser_timezone, $timezone)==0): ?> selected="selected" class="selected"<?php endif; ?>><?php echo $timezone; ?>&nbsp;&nbsp;</option>
                    <?php endforeach; ?>
                    </select>
                </li>
            </ul>

            <h2 class="test">Sample content for testing</h2>
            <ul class="test">
                <li class="setup_item_label"><label for="insertsamplecontent">Insert sample content:</label></li>
                <li class="setup_item_content">
                    <input type="checkbox" id="insertsamplecontent" name="insertsamplecontent" value="yes" />
                </li>
            </ul>

            <div id="namespace_spatial">
        <h2>Namespace</h2>
        <ul>
      <li class="setup_item_label"><label for="namespace">Namespace:</label></li>
      <li class="setup_item_content">
          <select name="namespace" id="namespace" size="1">
          <option value="namespace"<?php if($form_namespace=='namespace'): ?> selected="selected" class="selected"<?php endif; ?>>namespace</option>
          <option value="standalone"<?php if($form_namespace=='standalone'): ?> selected="selected" class="selected"<?php endif; ?>>standalone</option>
          <option value="test"<?php if($form_namespace=='test'): ?> selected="selected" class="selected"<?php endif; ?>>test</option>
          </select>
      </li>

      <li class="setup_item_label namespace"><label for="namespace_value">Namespace value:</label></li>
      <li class="setup_item_content namespace">
          <input name="namespace_value" id="namespace_value" class="namespace" type="text" maxlength="50" value="<?php if(isset($form_namespace_value)) echo $form_namespace_value; else echo ''; ?>" />
      </li>

      <li class="setup_item_label"><label for="serial">System serial:</label></li>
      <li class="setup_item_content">
          <input name="serial" readonly="readonly" id="serial" type="text" maxlength="18" value="<?php if(!empty($form_serial)) echo $form_serial; else echo '9223000000000000000'; ?>" />
      </li>
        </ul>

        <h2>Spatial reference system identifier</h2>
        <ul>
      <li class="setup_item_label"><label for="srid">SRID</label></li>
      <li class="setup_item_content">
          <input name="srid" id="srid" type="text" size="40" maxlength="8" value="<?php if(!empty($form_srid)) echo $form_srid; else echo 4326; ?>" />

      </li>
        </ul>
            </div>

            <h2>Launch setup</h2>
            <ul>
                <li class="setup_item_label"><label for="submit">Submit form:</label></li>
                <li class="setup_item_content">
                    <input type="submit" name="do_setup" id="submit" value="Submit" />
                </li>
            </ul>

            </form>
            <!-- end: setup data form -->



        <!--#####################-->
        <!-- END: Setup form -->
        <!--#####################-->
        </div>
        <div id="ie_clearing">&nbsp;</div>
        <!-- End: IE Column Clearing -->
      </div>
      <!-- end: #col3 -->
    </div>
  </div>
</div>
<!-- end: #main -->

<!-- begin: #footer -->
<div id="footer">
  <div class="page_margins">
    <div class="page">
      GeoContexter ()<br />Layout based on <a href="http://www.yaml.de/en">YAML</a>
    </div>
  </div>
</div>
<!-- end: #footer -->

</body>
</html>
